/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package autenticacionmodulo;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 *
 * @author Larry
 */
public class CargadorXml {

    public NewDataSet getNewDataSet(String xml) throws FileNotFoundException {
	XStream xstream = new XStream(new DomDriver());
	xstream.alias("NewDataSet", NewDataSet.class);
	xstream.aliasAttribute(NewDataSet.class, "datosUsuario", "DATOS_USUARIO");
	xstream.aliasAttribute(DatosUsuario.class, "matricula", "MATRICULA");
	xstream.aliasAttribute(DatosUsuario.class, "cedula", "CEDULA");
	xstream.aliasAttribute(DatosUsuario.class, "apellidos", "APELLIDOS");
	xstream.aliasAttribute(DatosUsuario.class, "nombres", "NOMBRES");
	xstream.aliasAttribute(DatosUsuario.class, "nombreCompleto", "NOMBRE_COMPLETO");
	xstream.aliasAttribute(DatosUsuario.class, "unidad", "UNIDAD");
	xstream.aliasAttribute(DatosUsuario.class, "rol", "ROL");
	xstream.aliasAttribute(DatosUsuario.class, "correo", "CORREO");
	xstream.aliasAttribute(DatosUsuario.class, "direccion", "DIRECCION");
	xstream.aliasAttribute(DatosUsuario.class, "telefono", "TELEFONO");
	xstream.aliasAttribute(DatosUsuario.class, "celular", "CELULAR");
	xstream.aliasAttribute(DatosUsuario.class, "sexo", "SEXO");
	xstream.aliasAttribute(DatosUsuario.class, "carrera", "CARRERA");
	xstream.aliasAttribute(DatosUsuario.class, "especializacion", "ESPECIALIZACION");
	xstream.aliasAttribute(DatosUsuario.class, "fechaNacimiento", "FECHANACIMIENTO");
	xstream.aliasAttribute(DatosUsuario.class, "promedio", "PROMEDIO");
	xstream.aliasAttribute(DatosUsuario.class, "materiasAprobadas", "MATERIASAPROBADAS");
	xstream.aliasAttribute(DatosUsuario.class, "lastChanged", "LASTCHANGED");

//	InputStream is = new BufferedInputStream(new FileInputStream("Prueba.xml"));
	NewDataSet obj = (NewDataSet) xstream.fromXML(xml);
	return obj;
    }
}
